package com.minibobbo.utilities.spe.aimodules;

public class SpeAIWalkBackAndForth extends SpeAIModule {

	boolean right  = true;
	
	@Override
	public void updateAI(float delta) {
		parent.resetMovementVariables();
		if(parent.tR)
			right  = false;
		if(parent.tL) 
			right = true;
		
		int xx = (int)parent.loc.getLR().x;
		int yy = (int) parent.loc.getLR().y-1;
		
		if(!e.getCurrentMap().getTileContact(xx, yy))
			right = false;
		xx = (int) parent.loc.getLL().x;
		if(!e.getCurrentMap().getTileContact(xx, yy))
			right = true;
		
		if(right)
			parent.r = true;
		if(!right)
			parent.l = true;
	}

}
